import service from "@/service/http.interceptor";

/**
 * 创建订单
 */
export const create = (data) => {
	return service.request({
		method: 'post',
		url: '/shop_order/order/c/create',
		data,
		custom: {
			loading: true
		}
	})
}

/**
 * 支付
 */
export const pay = (data) => {
	return service.request({
		method: 'post',
		url: '/shop_order/order/c/wechatPay',
		data,
		custom: {
			loading: true
		}
	})
}

/**
 * 获取订单详情
 */
export const getOrderInfo = (params) => {
	return service.request({
		method: 'get',
		url: `/shop_order/order/c/orderInfo/${params.orderId}`,
		params,
		custom: {
			loading: true
		}
	})
}

/**
 * 分页获取订单列表
 */
export const getOrderPageList = (params) => {
	return service.request({
		method: 'get',
		url: `/shop_order/order/c/order/page`,
		params,
		custom: {
			loading: true
		}
	})
}


/**
 * 订单支付
 */
export const orderPay = (data) => {
	return service.request({
		method: 'post',
		url: `/shop_order/order/pay/successed`,
		data,
		custom: {
			loading: true
		}
	})
}

/**
 * 订单签收
 */
export const orderSignFor = (data) => {
	return service.request({
		method: 'post',
		url: `/shop_order/order/c/orderSingFor`,
		data,
		custom: {
			loading: true
		}
	})
}


/**
 * 取消订单
 */
export const orderCancel = (data) => {
	return service.request({
		method: 'post',
		url: `/shop_order/order/c/cancel`,
		data,
		custom: {
			loading: true
		}
	})
}

/**
 * 继续支付
 */
export const orderRePay = (data) => {
	return service.request({
		method: 'post',
		url: `/shop_order/order/c/rePay`,
		data,
		custom: {
			loading: true
		}
	})
}